#ifndef _FS_H
#define  _FS_H
#define BSIZE 512  // block size
// Directory is a file containing a sequence of dirent structures.
#define DIRSIZ 14
void fsinit(int dev);
/*
// On-disk file system format.
// Both the kernel and user programs use this header file.
#include "types.h"

#define ROOTINO  1   // root i-number

// Disk layout:
// [ boot block | super block | log | inode blocks |
//                                          free bit map | data blocks]
//
// mkfs computes the super block and builds an initial file system. The
// super block describes the disk layout:
struct superblock {
  uint magic;        // Must be FSMAGIC
  uint size;         // Size of file system image (blocks)
  uint nblocks;      // Number of data blocks
  uint ninodes;      // Number of inodes.
  uint nlog;         // Number of log blocks
  uint logstart;     // Block number of first log block
  uint inodestart;   // Block number of first inode block
  uint bmapstart;    // Block number of first free map block
};

#define FSMAGIC 0x10203040

#define NDIRECT 12
#define NINDIRECT (BSIZE / sizeof(uint))
#define MAXFILE (NDIRECT + NINDIRECT)


// Inodes per block.
#define IPB           (BSIZE / sizeof(struct dinode))

// Block containing inode i
#define IBLOCK(i, sb)     ((i) / IPB + sb.inodestart)

// Bitmap bits per block
#define BPB           (BSIZE*8)

// Block of free map containing bit for block b
#define BBLOCK(b, sb) ((b)/BPB + sb.bmapstart)

// Directory is a file containing a sequence of dirent structures.
#define DIRSIZ 14



int namecmp(const char *s,const char *t);
struct inode* nameiparent(char *path, char *name);
struct inode* namei(char *path);
struct inode* idup(struct inode *ip);
void iunlock(struct inode *ip);
void iunlockput(struct inode *ip);

static void bfree(int dev, uint b);
void iupdate(struct inode *ip);
void iput(struct inode *ip);
static uint balloc(uint dev);
static void bzero_r(int dev, int bno);
static uint bmap(struct inode *ip, uint bn);
int readi(struct inode *ip, int user_dst, uint64 dst, uint off, uint n);
int writei(struct inode *ip, int user_src, uint64 src, uint off, uint n);
struct inode* dirlookup(struct inode *dp, char *name, uint *poff);
struct inode*   ialloc(uint, short);
int dirlink(struct inode *dp, char *name, uint inum);
void ilock(struct inode *ip);
void itrunc(struct inode *ip);
void print_inode(struct inode* inode);
*/
#endif
